package cn.tedu.ivos.vehicle.pojo.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import java.util.Date;

/**
 * @author liyuehui
 * @time 2024/7/10 11:23
 */
@Data
public class VehicleSaveDTO {
    @ApiModelProperty(value = "车辆id", example = "101")
    private Long id;
    @NotEmpty(message = "品牌不能为空")
    @ApiModelProperty(value = "品牌", example = "特斯拉", required = true)
    private String brand;
    @NotEmpty(message = "车牌号不能为空")
    @ApiModelProperty(value = "车牌号", example = "川A88888", required = true)
    private String license;
    @NotEmpty(message = "型号不能为空")
    @ApiModelProperty(value = "型号", example = "Model S", required = true)
    private String model;
    @NotEmpty(message = "车辆编号不能为空")
    @ApiModelProperty(value = "车辆编号", example = "123456", required = true)
    private String code;
    @NotEmpty(message = "请选择排量")
    @ApiModelProperty(value = "排量", example = "0", required = true)
    private String displacement;
    @NotEmpty(message = "请选择车辆类型")
    @ApiModelProperty(value = "车辆类型", example = "10", required = true)
    private String type;
    @NotEmpty(message = "请选择颜色")
    @ApiModelProperty(value = "颜色", example = "10", required = true)
    private String color;
    @NotEmpty(message = "请输入行驶里程")
    @ApiModelProperty(value = "行驶里程", example = "10000", required = true)
    private String kilometers;
    /**
     * 将前端传过来的String时间类型转换成Date类型
     * 如不加该注解会出现400 TypeMismatchException
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "购买时间", example = "2024-07-04")
    private Date buyTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "注册时间", example = "2024-07-04")
    private Date regTime;
    @NotEmpty(message = "请输入车辆价格")
    @ApiModelProperty(value = "价格", example = "27.19w", required = true)
    private String price;
    @NotEmpty(message = "请选择电池类型")
    @ApiModelProperty(value = "电池类型", example = "10", required = true)
    private String batteryType;
}
